/**
 * 
 */
package com.googlecode.pcapj.bridj;

import org.bridj.Pointer;
import org.bridj.StructObject;
import org.bridj.ann.Field;

/**
	uint16_t  src_port 
	uint16_t  dst_port 
	uint16_t  length 
	uint16_t  crc 
 */
public class udp_header extends StructObject {
    public udp_header() { super(); }
    public udp_header(Pointer<? extends StructObject> pointer) { super(pointer); }

    /**
     * 
     * @return
     */
    @Field(0) 
    public uint16_t src_port() {
    	return this.io.getNativeObjectField(this, 0);
    }
    /**
     * 
     * @param src_port
     * @return
     */
    @Field(0) 
    public udp_header src_port(uint16_t src_port) {
        this.io.setNativeObjectField(this, 0, src_port);
        return this;
    }
    
    /**
     * @return
     */
    @Field(1) 
    public uint16_t dst_port() {
    	return this.io.getNativeObjectField(this, 1);
    }
    /**
     * @param dst_port
     * @return
     */
    @Field(1) 
    public udp_header dst_port(uint16_t dst_port) {
        this.io.setNativeObjectField(this, 1, dst_port);
        return this;
    }
    
    /**
     * @return
     */
    @Field(2) 
    public short length() {
            return this.io.getShortField(this, 2);
    }
    /**
     * @param tos
     * @return
     */
    @Field(2) 
    public udp_header length(short length) {
            this.io.setShortField(this, 2, length);
            return this;
    }

    /**
     * @return
     */
    @Field(3) 
    public short crc() {
            return this.io.getShortField(this, 3);
    }
    /**
     * @param tos
     * @return
     */
    @Field(3) 
    public udp_header crc(short crc) {
            this.io.setShortField(this, 3, crc);
            return this;
    }
    public int getSourcePort(){
    	return src_port().toInt(Endian.BIG);
    }
    public int getDestinationPort(){
    	return dst_port().toInt(Endian.BIG);
    	
    }
}
